package com.quantum.lang
{

	/**
	 * http://scottbilas.com/blog/ultimate-as3-fake-enums/
	 */
	public final class NetError extends Enum
	{
		// static ctor
		{
			initEnum(NetError);
		}

		// Constants      
		public static const None:NetError=new NetError(false, "no error");
		public static const CantConnect:NetError=new NetError(false, "can't connect to the server, must be down?");
		public static const VersionMismatch:NetError=new NetError(true, "protocol versions different");
		public static const Unknown:NetError=new NetError(true, "unexpected error type");


		private var _isFatal:Boolean;
		private var _description:String;

		/*private*/
		function NetError(isFatal:Boolean, description:String)
		{
			_isFatal=isFatal;
			_description=description;
		}

		// Constant attributes      
		public function get isFatal():Boolean
		{
			return _isFatal;
		}

		public function get description():String
		{
			return _description;
		}

		// Constant query      
		public static function getEnumConstants():Array
		{
			return Enum.getEnumConstants(NetError);
		}

		public static function get(constantName:String, caseSensitive:Boolean=false):NetError
		{
			return NetError(Enum.get(NetError, constantName, caseSensitive));
		}
	/* test */
//      for each (var netError :NetError in NetError.GetConstants())
//      {
//         trace(
//            netError.index + ": " + netError.name +
//            " (" + netError.Description + ") " +
//            (netError.isFatal ? "[FATAL]" : ""));
//      }


	}

}